<template>
	<view class="container">
		<view>
			<desc-wrapper :title="title1" :desc="desc"></desc-wrapper>
			<z-card title="吉日查询概述">
				<text>{{base_info.summarize}}</text>
			</z-card>
			
			<z-card title="吉日查询列表">
				<block >
					<view class="" style="margin-bottom: 20rpx;" v-for="(item, k) in detail_info" :key="k">
					      <view class="biaoti" style='width: 350rpx;display: flex;justify-content: center;'>
					      	{{item.yangli}}{{item.xingqi}}
					      </view>
						<view class="card-content-item " style='margin-top: 10rpx;'>
							<text class="shrink-0 card-content-label_left" style='font-size: 13px;'>宜:</text>
							<text class="card-content_right card-text-black">{{ item.yi }} </text>
						</view>
						<view class="card-content-item ">
							<text class="shrink-0 card-content-label_left" style='font-size: 13px;'>忌:</text>
							<text class="card-content_right card-text-black">{{ item.ji }} </text>
						</view>
						<view class="card-content-item ">
							<text class="shrink-0 card-content-label_left" style='font-size: 13px;'>冲:</text>
							<text class="card-content_right card-text-black">{{ item.chongsha }} </text>
						</view>
						<view class="card-content-item " @click='gotolao(item.yangli)'>
							<text class="shrink-0 card-content-label_left" style='font-size: 13px;'>时:</text>
							<text class="card-content_right card-text-black" style="color: skyblue;">吉时详情</text>
						</view>
					</view>	
				</block>
			</z-card>
			
			<view class="bottom-btns" style="transform: translateY(-100%);" @click="todashi">
				<view class="start-btn">
					<text>大师详解</text>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title1: '择日查好分析',
				desc: '本次测算结果仅供娱乐使用，请勿用于封建迷信和违法用途。',
				base_info: {},
				detail_info: [],
				yangli: ''
			}
		},
		onLoad(opt) {
			const that = this;
			let params = JSON.parse(opt.formData);
			uni.request({
				url: 'https://cs.appzdm.com:3000/Gongju/zeshi',
				method: 'POST',
				header: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				data: params,
				success: (res) => {
					console.log(res.data.data, '###########');
					that.base_info = res.data.data.base_info;
					that.detail_info = res.data.data.detail_info;
					uni.setStorageSync('zgjm', res.data.data.detail_info);
				},
				fail: (error) => {
					console.error('Request Failed:', error);
				}
			});
		},
		methods: {
			todashi() {
				uni.switchTab({
					url: '/pages/tabbar/service'
				});
			},
			gotolao(yangli) {
				console.log('this.yangli:', yangli);
				uni.navigateTo({
					url: '/pages/laohuangli/laohuangli?yangli=' + encodeURIComponent(yangli)
				});
			},
		}
	}
</script>

<style lang="scss">
.biaoti {
	background: #ffffff;
	box-shadow: 0rpx 5rpx 6rpx 2rpx rgba(39, 85, 21, 0.18);
	border-radius: 5rpx;
}
</style>
